package com.nbicc.file.po;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.nbicc.parent.BaseBean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;

@ApiModel("文件")
@Data
public class File extends BaseBean{

    @ApiModelProperty("文件id")
    @JsonSerialize(using= ToStringSerializer.class)
    private long id;
    @ApiModelProperty("文件原名")
    private String name;
    @ApiModelProperty("按日期生成存储路径(文件夹)")
    private String relativeFolder;
    @ApiModelProperty("//相对全路径")
    private String relativePath;
    @ApiModelProperty("在文件系统中 已存储的长度")
    private Long size;
    @ApiModelProperty("创建时间")
    private Date createTime;
    @ApiModelProperty("最后修改时间")
    private Date modifyTime;

    public void addSize(long size){
        if(this == null){
            this.size = size;
        }else{
            this.size += size;
        }
    }

}
